package com.by.controller;

import javax.servlet.ServletContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PathController {

    @Autowired
    private ServletContext servletContext;

    @GetMapping("/serverPath")
    public String getServerPath() {
        String realPath = servletContext.getRealPath("/");
        return "服务器根目录: " + realPath;
    }
}
